<?php
/*
 * @Author: Zhang Yingying
 * @Date: 2020-11-04 17:41:50
 * @LastEditors: Zhang Yingying
 * @LastEditTime: 2020-11-25 22:52:46
 */
declare (strict_types = 1);

namespace app\validate;
use think\Validate;

class ProductsValidate extends Validate
{
    /**
     * 定义验证规则
     * @var array
     */
    protected $rule = [
      'productName' => 'require',
      'category' => 'require',
      'subCategory' => 'require',
      'inventory' => 'require',
      'price' => 'require|number',
      'discountPrice' => 'number',
      'description' => 'require',
      'state' => 'require'
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
      'productName' => '产品名必填',
      'category' => '一级分类必填',
      'subCategory' => '二级分类必填',
      'description' => '产品描述必填',
      'price' => '产品价格不正确',
      'discountPrice' => '折扣价格不正确',
      'state' => '状态必填',
    ];
}
